package net.com.hydroPK.model.ptrade;

import net.com.hydroPK.Engine;
import net.com.hydroPK.model.*;

public class TButtons {
private Player p;

public TButtons(Player p) {

this.p = p;

}


public void handleButton(int interfaceId, int packetId, int buttonId, int buttonId2) {

switch (interfaceId) {

case 334:

secondScreen(packetId, buttonId, buttonId2);

break;

case 335:

firstScreen(packetId, buttonId, buttonId2);

break;

case 336:

inventoryItems(packetId, buttonId2);

break;


}

}


public void firstScreen(int packetId, int buttonId, int buttonId2) {

switch (buttonId) {

case 16:

p.pTrade.confirmTrade();

break;

case 12:

case 18:

p.pTrade.declineTrade();

break;

case 30:

switch (packetId) {

case 233:
p.pTrade.removeItemB(buttonId2, 1);
break;

case 21:
p.pTrade.removeItemB(buttonId2, 5);
break;

case 169:
p.pTrade.removeItemB(buttonId2, 10);
break;

case 214:
p.pTrade.removeItemB(buttonId2, p.items[buttonId2]);
break;

case 173:
p.input.request(4, buttonId2);
p.inputSlot = buttonId2;
break;

}

break;

}


}


public void secondScreen(int packetId, int buttonId, int buttonId2) {

switch (buttonId) {

case 20:

p.pTrade.confirmTrade();

break;

case 8:

case 21:

p.pTrade.declineTrade();

break;

}


}


public void inventoryItems(int packetId, int buttonId2) {

switch (packetId) {

case 233:

p.pTrade.tradeItemB(buttonId2, 1);

break;

case 21:

p.pTrade.tradeItemB(buttonId2, 5);

break;

case 169:

p.pTrade.tradeItemB(buttonId2, 10);

break;

case 214:
p.pTrade.tradeItemB(buttonId2, Engine.playerItems.invItemCount(p, p.items[buttonId2]));
break;

case 173:
p.input.request(1, buttonId2);
p.inputSlot = buttonId2;

break;

}

}

}
